﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data.OleDb;
using System.Data;
namespace DAO
{
   public class HoaDonDAO
    {
       public DataTable LayThongTinHoaDonTuMaPhieuDAO(int maPhieu)
       {
           return DataProvider.DataTableQueryParameters("LayThongTinHoaDon", "@MaPhieu", maPhieu);

       }
       public int ThemHoaDon(HoaDonDTO dto)
       {
           try
           {
               return DataProvider.ExecQueryWithParameters("ThemHoaDon", "@TenKH", dto.Tenkh, "@TriGia", dto.Thanhtien, "@DiaChi", dto.Diachikh, "@NgayLap", dto.Ngaylap);
           }
           catch (Exception ex)
           {
               throw ex;
           }
       }
       public int LayMaxHoadon()
       {
           return DataProvider.getMAX("Select Max(MaHD) from HoaDon");
       }
      
    }
}
